﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Admin_Admin_XoaTaiKhoan : System.Web.UI.Page
{
    string CMND = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            btnXoa1.Attributes["OnClick"] = "return confirm('Bạn thật sự muốn xóa');";
        }
    }
    protected void btnXoa_Click(object sender, EventArgs e)
    {
        CMND = txtCMND.Text;
        DataDSTableAdapters.TAIKHOANTableAdapter tkadapter = new DataDSTableAdapters.TAIKHOANTableAdapter();
        DataDS.TAIKHOANDataTable tktable = tkadapter.TAIKHOAN_LayTheoCMND(CMND);
        if (tktable.Rows.Count == 0)
        {
            Response.Write("Không tồn tại!");
        }
        else
        {
            imgHinhAnh.ImageUrl = tktable.Rows[0]["Avatar"].ToString();
            lblHoTen.Text = tktable.Rows[0]["HoTen"].ToString();
            lblDiaChi.Text = tktable.Rows[0]["DiaChi"].ToString();
            lblEmail.Text = tktable.Rows[0]["Email"].ToString();
            pnlSanPham.Visible = true;
        }
    }
    protected void btnXoa1_Click(object sender, EventArgs e)
    {
        string chuoi = txtCMND.Text;
        DataDSTableAdapters.TAIKHOANTableAdapter tkadapter = new DataDSTableAdapters.TAIKHOANTableAdapter();
        int? kq = 0;
        tkadapter.TAIKHOAN_XoaTheoCMND(chuoi, ref kq);
        if (kq == 0)
            modelXoaThanhCong.Show();
        else
            modelKhongThanhCong.Show();
        //Response.Redirect("Admin_XoaTaiKhoanDang1.aspx");
       
    }
}
